// 接口的作用：扩展能力
interface fly {
    flying(): void
}
interface swim {
    swimming(): void
}

class Pig implements fly, swim {
    age: number
    brand: string
    constructor(age: number, brand: string) {
        this.age = age
        this.brand = brand
    }
    eat() {
        console.log('猪吃饭');

    }
    sleep() {
        console.log('猪睡觉');
    }
    flying() {
        console.log('猪飞翔');
    }
    swimming(): void {
        console.log('猪游泳');
    }
}

// type Spark = {
//     appId: string
//     appKey: string
//     secrit: number
// }

// type SN  = string | number // type更适合去定义联合类型

interface Spark{
    appId: string
    appKey: string
    secrit: number
}

interface Spark{
    time: number
}

interface SparkRequest extends Spark {
    requestType: string
}

let sr:SparkRequest = {
    requestType : 'POST', 
    appId: 'appId', 
    appKey: 'appKey', 
    secrit: 123, 
    time: 123
}